package com.lys.blog.utils;

import com.lys.blog.dao.pojo.SysUser;
import org.springframework.stereotype.Component;

@Component
public class UserThreadLocal {

    private UserThreadLocal() {
    }

    private static final ThreadLocal<SysUser> local = new ThreadLocal<>();

    public static void put(SysUser user) {
        local.set(user);
    }

    public static SysUser get() {
        return local.get();
    }
    /**
     * 清空
     */
    public static void remove() {
        local.remove();
    }
}
